#ifndef HASIO_IP_BASIC_ENDPOINT_HPP
#define HASIO_IP_BASIC_ENDPOINT_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include "detail/endpoint_impl.hpp"
#include "../detail/socket_types.hpp"

namespace hasio {
namespace ip {

template <typename Protocol>
class basic_endpoint {
public:
    using protocol_type = Protocol;
    using data_type = hasio::detail::socket_addr_type;
    using port_type = hasio::detail::ushort_type;

    basic_endpoint()
        : impl_()
    {
    }

    protocol_type protocol() const
    {
        if (impl_.is_v4())
            return Protocol::v4();
        return Protocol::v6();
    }

    port_type port() const
    {
        return impl_.port();
    }

private:
    hasio::ip::detail::endpoint_impl impl_;
};

}
}

#endif // HASIO_IP_BASIC_ENDPOINT_HPP